import { createStore } from "vuex";
import { getItem, setItem} from "../utils/storage";
const TOKEN_KEY="TOKEN_USER";
const store =createStore({
    state:{
        user:getItem(TOKEN_KEY),
    },
    mutations:{
        setUser(state,data){
            state.user=data;
            //持久化
    
            setItem(TOKEN_KEY,state.user)
        }
    }

});
export default store;